diff options
| author | Factiven <[email protected]> | 2023-04-17 16:17:45 +0700 |
|---|---|---|
| committer | Factiven <[email protected]> | 2023-04-17 16:17:45 +0700 |
| commit | 9a9e892a1f43a61188cfd08ef1faaf5100d0a41a (patch) | |
| tree | 005b6b4e5b786139b266847b6548770f9de6bca3 /pages/anime/watch/[...info].js | |
| parent | Update [user].js (diff) | |
| download | moopa-9a9e892a1f43a61188cfd08ef1faaf5100d0a41a.tar.xz moopa-9a9e892a1f43a61188cfd08ef1faaf5100d0a41a.zip | |
4th fixes
Diffstat (limited to 'pages/anime/watch/[...info].js')
| -rw-r--r-- | pages/anime/watch/[...info].js | 70 |
1 files changed, 66 insertions, 4 deletions
diff --git a/pages/anime/watch/[...info].js b/pages/anime/watch/[...info].js index e7195d6..ba3a078 100644 --- a/pages/anime/watch/[...info].js +++ b/pages/anime/watch/[...info].js @@ -423,11 +423,73 @@ export async function getServerSideProps(context) { .filter((item) => item.id == id) .map((item) => item.number); - const resp = await fetch( - `https://moopa-anilist.vercel.app/api/get-media?username=${query.user}` - ); + const response = await fetch("https://graphql.anilist.co/", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + query: ` + query ($username: String, $status: MediaListStatus) { + MediaListCollection(userName: $username, type: ANIME, status: $status, sort: SCORE_DESC) { + user { + id + name + about (asHtml: true) + createdAt + avatar { + large + } + statistics { + anime { + count + episodesWatched + meanScore + minutesWatched + } + } + bannerImage + mediaListOptions { + animeList { + sectionOrder + } + } + } + lists { + status + name + entries { + id + mediaId + status + progress + score + media { + id + status + title { + english + romaji + } + episodes + coverImage { + large + } + } + } + } + } + } + `, + variables: { + username: session?.user.name, + }, + }), + }); + + const dat = await response.json(); - const prog = await resp.json(); + const prog = dat.data.MediaListCollection; const gat = prog?.lists.map((item) => item.entries); const git = gat?.map((item) => |